Actionable hashcat error on GPU-less environments - #111
Conversation
…ckend On GPU-less VMs, hashcat exits with CL_PLATFORM_NOT_FOUND_KHR and the agent gets an opaque error. Catch this specific failure and raise with a clear message directing the agent to use john_the_ripper instead, including the correct hash_format for known modes. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves the network-ops cracking tool UX on GPU-less environments by turning common hashcat “no backend” failures into actionable guidance that suggests using john_the_ripper, including mode→format hints for a few known hash types.
Changes:
- Added hashcat-mode → john-format mapping for a small set of common modes.
- Intercepted hashcat failures that look like missing OpenCL/CUDA/HIP backends and raised a clearer, actionable error message.
- Minor formatting adjustments for readability of some
execute(...)calls.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…john under hashcat variant Add three tests covering backend-marker detection (known mode, unknown mode, non-backend error propagation). Register john_the_ripper under the hashcat variant so the fallback suggestion is actionable. Co-Authored-By: Claude <noreply@anthropic.com>
Drop the unknown-mode test (just a dict miss) and add a test verifying the original hashcat error is preserved as __cause__ on the re-raised RuntimeError. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (2)
capabilities/network-ops/tests/test_tool_fixes.py:616
- PR description mentions an “unknown mode” test case for the no-backend branch, but the current tests don’t cover the
hashcat_modepath where no john format mapping exists (theHASHCAT_TO_JOHN.get()miss). Add a test that asserts the error message includes the “no automatic john format mapping” guidance whenhashcat_modeis unmapped.
@pytest.mark.asyncio
capabilities/network-ops/tools/cracking.py:93
- The broad
except Exceptioncan intercept task cancellation (e.g.,asyncio.CancelledError) and potentially re-wrap it as a backend-missingRuntimeError, which can break cooperative cancellation/timeouts. Re-raise cancellations explicitly before the generic handler.
except Exception as e:
mkultraWasHere
left a comment
There was a problem hiding this comment.
Addressed suppressed Copilot comments:
-
Unmapped mode test — Refuted. Deliberately removed in
3219f54as low-value (tests a dict lookup miss). PR description is stale from the earlier commit. -
except ExceptioncatchingCancelledError— Refuted.asyncio.CancelledErroris aBaseExceptionin Python 3.9+ and won't be caught. The bareraiseat line 107 re-raises anything that doesn't match backend markers.
Co-Authored-By: Claude <noreply@anthropic.com>
On GPU-less VMs,
hashcatexits immediately withCL_PLATFORM_NOT_FOUND_KHRand the agent gets an opaque error with no guidance on how to proceed.Fixed
hashcattool no longer returns an opaque error on environments without OpenCL/CUDA/HIP — it now tells the agent to usejohn_the_ripperwith the correcthash_formatfor known modes (1000→nt, 2100→mscash2, 13100→krb5tgs, 18200→krb5asrep)Notes
john_the_ripperitself